Non-volatile memory devices such as, for example FLASH memory devices, may include an array of memory cells divided into a number of sectors. Each sector may include a large number of bits which may number into the millions, for example, 1 million bits or even two million bits, or more. The bits may be arranged into pages where each page includes data bits for storing user information and ECC (error correcting code) bits corresponding to an ECC syndrome for protecting the user information by for error correction. Use of the EEC bits substantially ensures that the stored user information, when read, is the same as that which was written to memory. A typical sector in a memory device may have hundreds, and in some cases, thousands of pages.
Non-volatile memory devices may be subject to program-on-program operations. These type of operations generally include overwriting one or more data bits on a page that already includes some programmed bits in it, while the ECC syndrome for the page is left unchanged. Consequently, the ECC syndrome in the changed page may no longer be valid and is unable to protect the data in the page (the page may be considered to be unprotected). Furthermore, as the unprotected page is included in a sector, the sector may also be considered to be unprotected.
A sector is typically programmed by writing onto the pages one page at a time. This allows the user to write onto only one page, if so desired. Erasing, on the other hand, generally requires that all pages in the sector be erased. Consequently, a user wishing to erase only one page must erase all the pages and then rewrite the erased information onto all the pages except that intended to be erased.
Non-volatile memory devices are generally limited to a maximum number of program/erase (P/E) cycles. This represents the maximum number of times a sector may be programmed and erased in a device (may also be referred to as maximum number of erase cycles, or maximum ECN, erase cycle number). Once a sector reaches the maximum number of P/E cycles, the device is considered to have reached “end-of-life” and may be considered unreliable, at which point it is generally discarded. This is of particular importance when data is continuously written to a same sector in a memory device as the maximum number of P/E cycles is quickly reached, shortening the lifetime of the device.
Wear-leveling is a process used for increasing the lifetime of non-volatile memories by storing data in a manner so that sector ECN is distributed more evenly across the different sectors of a memory array. These algorithms generally serve to remap logical-sector addresses to different physical-sector addresses in the array in what is frequently referred to as “address swapping”. The algorithms may include tracking least used sectors to identify next areas where data may be written into the array. The algorithms may also include tracking sectors to detect conditions which may trigger wear-leveling events associated with high P/E cycling. This process may reduce or even eliminate single sector failures resulting from a high concentration of P/E cycles in a limited number of sectors.
Reference is made to FIG. 1 which is a flow chart of an exemplary known (prior art) wear-leveling algorithm for non-volatile devices and includes address swapping.
At a step 100, a wear-leveling event is detected in a sector of a memory array in a non-volatile memory device, for example a sector E. The wear-leveling event may be associated with sector E reaching a predetermined number of P/E cycles, for example, 10000 P/E cycles or 20000 P/E cycles.
At a step 102, a sector with minimum ECN (P/E cycles) is identified in the memory array, for example a sector M.
At a step 104, sector E is erased.
At a step 106, the data in sector M is moved into the now erased sector E.
At a step 108, sector M is erased.
At a step 110, the physical address of sectors M and E are swapped. Data which is addressed to sector M will now be written from now on to sector E and data addressed to sector E will now be written from now on to sector M. At a step 112, the wear-leveling algorithm ends. The algorithm may be reinitiated any time a sector is to be erased and a cycle counter of the sector reaches a pre-determined level associated with a requisite for swapping.